package com.xc.erp.modules.erp.controller.material;

import com.xc.erp.modules.erp.service.JshMaterialService;
import com.xc.erp.modules.erp.domain.AjaxResult;
import com.xc.erp.modules.erp.domain.vo.DepotMaterialVo;
import com.xc.erp.modules.erp.domain.vo.ResultDepotMaterialVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/material")
public class MaterialController {
    @Autowired
    private JshMaterialService jshMaterialService;
    @GetMapping("/findBySelect")
    public AjaxResult findBySelect(DepotMaterialVo depotMaterialVo){
        List<ResultDepotMaterialVo> depotMaterialList = jshMaterialService.getDepotMaterialList(depotMaterialVo);
       return AjaxResult.success().put("rows",depotMaterialList).put("total",jshMaterialService.getDepotMaterialTotal(depotMaterialVo));
    }
    @GetMapping("/getMaterialByBarCode")
    public AjaxResult getMaterialByBarCode(String mBarCode,Long depotId){
        return AjaxResult.success().put("data", jshMaterialService.getMaterialByBarCode(mBarCode,depotId));
    }
}
